﻿using Flare.DB.Entity.Contract;
using System;
using System.Windows;
using System.Windows.Controls;

namespace Flare.Pages.ITContract
{
    public partial class Create : UserControl, ITypicalPage
    {
        public string name
        {
            get { return "Добавление"; }
        }

        public Create()
        {
            InitializeComponent();
        }

        private void insertButton_Click(object sender, RoutedEventArgs e)
        {
            var data = new contract_list()
            {
                id_service = (int)id_service.SelectedValue,
                id_provider = (int)id_provider.SelectedValue,
                id_department = (int)id_department.SelectedValue,
                contract_number = contract_number.Text,
                contract_description = contract_description.Text,
                isclosed = false
            };

            try
            {
                new DB.contract_lists().Create(data);
            }
            catch (Exception ex)
            {
                glob.kernel.ShowNotice(ex.Message);
            }
        }

    }
}
